<template>
	<view class="main">
		<view v-if="type==1" class="content" @click="isShowZl=true">
			<image src="../../static/icon3/popupWatch/zl1.png" mode="aspectFill"></image>
			<text>{{`助力解禁(${num-count>=0?(num-count):0})`}}</text>
		</view>
		<view v-if="type==2" class="content" @click="yajin()">
			<image src="../../static/icon3/popupWatch/yj1.png" mode="aspectFill"></image>
			<text>{{`押金解禁(${deposit})`}}</text>
		</view>
		<view v-if="type==3" class="content" @click="fajin()">
			<image src="../../static/icon3/popupWatch/yj1.png" mode="aspectFill"></image>
			<text>{{`罚金解禁(${deposit}元)`}}</text>
		</view>
		<!-- 	<pay v-if="isShowPay" @closePayPage="closePayPage()" :info='payInfo' :price="deposit" :isPwd="false"
			:modalText1="'距离解封就差一步了'" :UnsealId="UnsealId"></pay> -->
		<ChangePay @closePayPage='closePayPage' v-if="isShowPay" :title='payInfo' :monery='deposit' :unsealId='UnsealId'
			:url="`${$api.v1_pay_penalty}`" keyWorld='commodityPrice' :contnet="requestObj" isJson='0' buycode=1
			@paySuccess='paySuccess'>
		</ChangePay>
		<jfzl v-if="isShowZl" @closerZl="closerZl()"></jfzl>
		<view v-if="type==1&&count>0" class="toakt">
			<view></view>
			<view>已成功被助力{{count}}次，还剩{{num-count}}次</view>
		</view>
	</view>
</template>
<script>
	import pay from './jfpay.vue'
	import jfzl from './jf-zl.vue'
	export default {
		data() {
			return {
				type: 1,
				deposit: 0,
				payInfo: `1、支付解封金后立即解禁
						2、解封金一旦支付，恕不退还
						3、解封金只对本次有效，请切勿再次违规`,
				isShowPay: false,
				UnsealId: uni.getStorageSync('FengjinItem').id,
				num: 3,
				count: 0,
				isShowZl: false,
				requestObj: {
					unsealId: uni.getStorageSync('FengjinItem').id
				}
			}
		},
		components: {
			pay,
			jfzl,
		},
		methods: {
			fajin() {
				this.isShowPay = true
			},
			yajin() {
				this.isShowPay = true
			},
			closePayPage() {
				this.isShowPay = false
			},
			closerZl() {
				this.isShowZl = false
			},
			paySuccess() {
				uni.navigateTo({
					url: '/pages/Succeed/Succeed?title=解禁罚金已经支付！&buttonTitle=返回首页&info=&name=支付成功'
				})
			},
		},
		beforeMount() {
			if (uni.getStorageSync('FengjinItem')) {
				this.type = uni.getStorageSync('FengjinItem').type
				this.deposit = (uni.getStorageSync('FengjinItem').penalty) / 100
				this.UnsealId = uni.getStorageSync('FengjinItem').id
				this.num = uni.getStorageSync('FengjinItem').scheduleNumber
				this.count = uni.getStorageSync('FengjinItem').schedule
			}
		},
	}
</script>
<style lang="less" scoped>
	.main {
		// width: 200rpx;
		height: 56rpx;
		position: fixed;
		right: 0;
		top: 30vh;
		z-index: 9998;
	}

	.content {
		// width: 200rpx;
		height: 56rpx;
		background: #FE4B28;
		border-radius: 28rpx 0px 0rpx 28rpx;
		display: flex;
		align-items: center;

		&>image {
			margin-left: 6rpx;
			width: 45rpx;
			height: 45rpx;
		}

		&>text {
			margin-left: 10rpx;
			margin-right: 10rpx;
			font-size: 20rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			line-height: 56rpx;
		}
	}

	.toakt {
		width: 403rpx;
		height: 88rpx;
		position: fixed;
		top: calc(30vh + 48rpx);
		right: 0;
		z-index: 2;
		display: flex;
		flex-direction: column;
		align-items: flex-end;

		&>view:nth-child(1) {
			width: 0px;
			height: 0px;
			border: 16rpx solid rgba(0, 0, 0, .7);
			border-top-color: transparent;
			border-left-color: transparent;
			border-right-color: transparent;
			margin-right: 60rpx;
		}

		&>view:nth-child(2) {
			width: 403rpx;
			height: 72rpx;
			border-radius: 12rpx;
			background-color: rgba(0, 0, 0, .7);
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			text-align: center;
			line-height: 72rpx;
		}
	}
</style>